home *** CD-ROM | disk | FTP | other *** search
Wrap
import java.applet.Applet; import java.awt.Color; import java.awt.Component; import java.awt.Cursor; import java.awt.Font; import java.awt.Graphics; import java.awt.Label; import java.awt.MenuItem; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.net.URL; class Item extends Label implements MouseListener, MouseMotionListener { // $FF: renamed from: mf MenuFrame2 MenuFrame2 field_0; String link; String statusText; Color textColor; Color enterTextColor; Color backColor; Color enterBackColor; Color borderColor; int borderSize; boolean isActive; boolean topItem; boolean hasChildren = false; MenuItem menuitem; public Item() { } public Item(String label, MenuFrame2 mf, String link, Color textColor, Color backColor, Color enterTextColor, Color enterBackColor, Color borderColor, int borderSize, boolean isActive) { super(" " + label + " "); this.field_0 = mf; this.link = link; this.textColor = textColor; this.backColor = backColor; this.enterTextColor = enterTextColor; this.enterBackColor = enterBackColor; this.borderSize = borderSize; this.borderColor = borderColor; this.isActive = isActive; Font f = ((Component)this).getFont(); String fontName = ((Applet)mf).getParameter("item_font_name"); if (fontName == null) { fontName = f.getName(); } String s = ((Applet)mf).getParameter("item_font_height"); int textHeight; if (s != null) { textHeight = Integer.parseInt(s); } else { textHeight = 12; } int style = 0; s = ((Applet)mf).getParameter("item_font_style"); if (s != null) { if (s.equals("bold")) { style = 1; } else if (s.equals("italic")) { style = 2; } else if (s.equals("bold_italic")) { style = 3; } else { style = 0; } } Font normalFont; try { normalFont = new Font(fontName, style, textHeight); } catch (Exception var17) { normalFont = new Font(f.getName(), style, textHeight); } ((Component)this).setFont(normalFont); ((Component)this).addMouseListener(this); ((Component)this).addMouseMotionListener(this); ((Component)this).setBackground(backColor); ((Component)this).setForeground(textColor); ((Label)this).setAlignment(1); if (!isActive) { ((Component)this).setVisible(false); } ((Component)this).repaint(); } public void update(Graphics g) { this.paint(g); } public void paint(Graphics g) { int wi = ((Component)this).getSize().width; int he = ((Component)this).getSize().height; if (this.borderSize > 0) { g.setColor(this.borderColor); for(int i = 0; i < this.borderSize; ++i) { g.drawRect(i, i, wi - 2 * i - 1, he - 2 * i - 1); } } if (this.hasChildren) { g.setColor(((Component)this).getForeground()); int height = ((Component)this).getSize().height; int width = ((Component)this).getSize().width; float h = (float)height / 5.0F; int l = (int)(Math.sqrt((double)3.0F) / (double)2.0F * (double)h); int x1 = width - 3 - this.borderSize - l; int x2 = width - 3 - this.borderSize; int y1 = (int)((double)((float)height) / (double)2.0F - (double)(h / 2.0F)); int y2 = height / 2; int y3 = (int)((double)((float)height) / (double)2.0F + (double)(h / 2.0F)); int X = 0; while(true) { g.drawLine(x1 + X, y1 + X, x1 + X, y3 - X); g.drawLine(x1 + X, y1 + X, x2 - X, y2); g.drawLine(x1 + X, y3 - X, x2 - X, y2); if (x1 + X >= x2 - X) { break; } ++X; } } } public void mouseClicked(MouseEvent e) { } public void mouseEntered(MouseEvent e) { if (this.topItem && this.field_0.isActive) { this.field_0.showFirstChildren(this.menuitem); } else if (!this.topItem) { this.field_0.showChildren(this.menuitem); } ((Component)this).setForeground(this.enterTextColor); ((Component)this).setBackground(this.enterBackColor); if (this.field_0.hand && !((Label)this).getText().equals("")) { ((Component)this).setCursor(Cursor.getPredefinedCursor(12)); } ((Component)this).repaint(); } public void mouseExited(MouseEvent e) { ((Component)this).setForeground(this.textColor); ((Component)this).setBackground(this.backColor); if (this.field_0.hand) { ((Component)this).setCursor(Cursor.getPredefinedCursor(0)); } ((Component)this).repaint(); } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { if (this.topItem) { this.field_0.showFirstChildren(this.menuitem); } if (!this.topItem && !this.hasChildren) { if (this.field_0.clicSound != null) { this.field_0.clicSound.play(); } URL u = this.field_0.giveURL(this.link); String target = this.field_0.getParameter("target"); if (target == null) { target = "_blank"; } this.field_0.getAppletContext().showDocument(u, target); } } public void mouseDragged(MouseEvent e) { } public void mouseMoved(MouseEvent e) { } }